package com.mflex.mpmmic.model;

import com.xuexiang.xhttp2.model.ApiResult;

public class CustomApiResult<T> extends ApiResult<T> {
    private boolean Success;
    private String Message;
    private T result;

    public void setSuccess(boolean success) {
        Success = success;
    }

    public String getMessage() {
        return Message;
    }

    public void setMessage(String message) {
        Message = message;
    }

    public T getResult() {
        return result;
    }

    public void setResult(T result) {
        this.result = result;
    }

    @Override
    public String toString() {
        return "CustomApiResult{" +
                "Success=" + Success +
                ", Message='" + Message + '\'' +
                ", result=" + result +
                '}';
    }

    @Override
    public int getCode() {
        return Success ? 0 : -1;
    }

    @Override
    public String getMsg() {
        return Message;
    }

    @Override
    public boolean isSuccess() {
        return Success;
    }

    @Override
    public ApiResult setData(T data) {
        result = data;
        return null;
    }

    @Override
    public T getData() {
        return result;
    }
}
